<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .box {
            position: relative;
            width: 200px;
            height: 40px;
            border: 1px solid red;
            margin: 20px auto;
            line-height: 40px;
            text-align: center;
        }

        .detail {
            display: none;
            position: absolute;
            top: 38px;
            right: -1px;
            width: 500px;
            height: 100px;
            z-index: -1;
            border: 1px solid red;
        }
    </style>
</head>

<body>
    <div class="box">
        <span>购物车</span>
        <div class="detail">
            购物车信息
        </div>
    </div>
    <script>
        let box = document.querySelector('.box')
        let detail = document.querySelector('.detail')
        box.onmouseover = function () {
            detail.style.display = 'block'
            box.style.borderBottomColor = 'white';
        }
        box.onmouseout = function () {
            detail.style.display = 'none'
            box.style.borderBottomColor = 'red';
        }
    </script>
</body>

</html>